package HLLibClasses;

import HLCode.HLClassManager;
import HLCode.HLLibClass;
import HLCode.HLObject;
import HLLib.base.HLImageManager;
import HLLib.io.HLPackage;

public class HLClassImageManager extends HLLibClass {
    public HLClassImageManager(HLClassManager owner) {
        super(owner);
    }

    public HLObject NewObject() {
        return new HLImageManager();
    }

    public void Execute(HLObject self, int index, HLObject args, HLObject resultOwnerObject, int resultIndex) {
        switch (index) {
        case 0: {
            ((HLImageManager) self).Clear();
            break;
        }
        case 1: {
            ((HLImageManager) self).Refresh();
            break;
        }
        case 2: {
            if (resultOwnerObject == null) {
                ((HLImageManager) self).GetImage(args.GetInt(0), args.GetInt(1));
            } else {
                resultOwnerObject.SetObject(resultIndex, ((HLImageManager) self).GetImage(args.GetInt(0), args.GetInt(1)));
            }
            break;
        }
        case 3: {
            if (resultOwnerObject == null) {
                ((HLImageManager) self).GetImageEX(args.GetInt(0), args.GetInt(1), args.GetBoolean(0));
            } else {
                resultOwnerObject.SetObject(resultIndex, ((HLImageManager) self).GetImageEX(args.GetInt(0), args.GetInt(1), args.GetBoolean(0)));
            }
            break;
        }
        case 4: {
            ((HLImageManager) self).Remove(args.GetInt(0));
            break;
        }
        }
    }

    public void StaticExecute(int index, HLObject args, HLObject resultOwnerObject, int resultIndex) {
        switch (index) {
        case 0: {
            if (resultOwnerObject == null) {
                HLImageManager.LoadImageByIndex(args.GetInt(0), args.GetInt(1));
            } else {
                resultOwnerObject.SetObject(resultIndex, HLImageManager.LoadImageByIndex(args.GetInt(0), args.GetInt(1)));
            }
            break;
        }
        case 1: {
            if (resultOwnerObject == null) {
                HLImageManager.OpenImagePackage(args.GetInt(0));
            } else {
                resultOwnerObject.SetBoolean(resultIndex, HLImageManager.OpenImagePackage(args.GetInt(0)));
            }
            break;
        }
        case 2: {
            HLImageManager.CloseImagePackage();
            break;
        }
        case 3: {
            HLImageManager.SetCurImagePackage((HLPackage)args.GetObject(0));
            break;
        }
        case 4: {
            if (resultOwnerObject == null) {
                HLImageManager.GetCurImagePackage();
            } else {
                resultOwnerObject.SetObject(resultIndex, HLImageManager.GetCurImagePackage());
            }
            break;
        }
        }
    }
}
